<template>
  <div class="leftdiv">
    <span
      class="corner corner-left-top"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-right-top"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-left-bottom"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <span
      class="corner corner-right-bottom"
      style="height: 12px; width: 12px; border: 4px solid rgb(0, 170, 255)"
    ></span>
    <div id="chart_left_top" style="width: 100%; height: 300px"></div>
  </div>
</template>
<script>
import * as echarts from "echarts";
export default {
  data() {
    return {
      myChart: null,
    };
  },
  mounted() {
    this.myChart = echarts.init(document.getElementById("chart_left_top"));
    this.initChart();
    window.addEventListener("resize", function () {
      this.myChart.resize();
    });
  },
  methods: {
    initChart() {
      let option = {
        // title: {
        //   text: "Stacked Area Chart",
        //   textStyle: {
        //     color: "#fff",
        //   },
        // },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#6a7985",
            },
          },
        },
        legend: {
          textStyle: {
            color: "#fff",
          },
          top:15,
          // data: ["Email", "Union Ads", "Video Ads", "Direct", "Search Engine"],
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            boundaryGap: false,
            data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
            axisLine: {
              lineStyle: {
                color: "#fff",
              },
            },
          },
        ],
        yAxis: [
          {
            type: "value",
            axisLine: {
              lineStyle: {
                color: "#fff",
              },
            },
          },
        ],
        series: [
          {
            name: "Email",
            type: "line",
            stack: "Total",
            areaStyle: {},
            emphasis: {
              focus: "series",
            },
            data: [120, 132, 101, 134, 90, 230, 210],
          },
          {
            name: "Union Ads",
            type: "line",
            stack: "Total",
            areaStyle: {},
            emphasis: {
              focus: "series",
            },
            data: [220, 182, 191, 234, 290, 330, 310],
          },
        ],
      };
      this.myChart.setOption(option);
    },
  },
};
</script>
<style scoped>
.leftdiv{
  position: relative;
}
.corner {
  position: absolute;
  background-color: transparent;
}
.corner-left-top {
  left: -1px;
  top: -1px;
  border-right: transparent !important;
  border-bottom: transparent !important;
}
.corner-right-top {
  right: -1px;
  top: -1px;
  border-left: transparent !important;
  border-bottom: transparent !important;
}
.corner-left-bottom {
  left: -1px;
  bottom: -1px;
  border-right: transparent !important;
  border-top: transparent !important;
}
.corner-right-bottom {
  right: -1px;
  bottom: -1px;
  border-left: transparent !important;
  border-top: transparent !important;
}
</style>